package com.szmmsoft.mp.common.until;

import com.alibaba.ttl.TransmittableThreadLocal;
import com.szmmsoft.mp.common.constant.Constants;
import org.slf4j.MDC;

/**
 * Description of the class.
 *
 * @author ethan
 * @version 1.0.0
 * @since 2024-10-17
 */
public class LoginUtil {
    static TransmittableThreadLocal<Long> INSTANCE = new TransmittableThreadLocal<>();

    public static void set(Long userId) {
        INSTANCE.set(userId);
    }

    public static Long get() {
        return INSTANCE.get();
    }
    public static String getRequestId() {
        return MDC.get(Constants.REQ_ID);
    }
    public static void clear() {
        INSTANCE.remove();
    }
}
